package com.caonima.proxy;

import com.caonima.dao.IConfigDao;
import com.caonima.dao.impl.ConfigDaoImpl;
import com.caonima.dbc.DatabaseConnection;
import com.caonima.vo.Config;

public class ConfigDaoProxy implements IConfigDao {
	IConfigDao dao = null;
	DatabaseConnection dbc = null;
	public ConfigDaoProxy() {
		try {
			this.dbc = new DatabaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		}
		this.dao = new ConfigDaoImpl(this.dbc.getConnection());
	}
	@Override
	public boolean doUpdate(Config config) throws Exception {
		boolean flag = false;
		try {
			flag = this.dao.doUpdate(config);
		} catch (Exception e) {
			throw e;
		} finally {
			this.dbc.close();
		}
		return flag;
	}

	@Override
	public Config findById(int cid) throws Exception {
		Config config = null;
		try {
			config = this.dao.findById(cid);
		} catch (Exception e) {
			throw e;
		} finally {
			this.dbc.close();
		}
		return config;
	}

}
